package org.example.mq;


import org.example.config.RabbitConfig;
import org.example.entity.Order;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

//生产者
@Component
public class SendImpl {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void send1(String key,String message){
        rabbitTemplate.convertAndSend(RabbitConfig.S59_DIRECT_EXCHANGE,key,message);
    }

//    public void send2(String key,String message){
//        rabbitTemplate.convertAndSend(RabbitConfig.S59_TOPIC_EXCHANGE,key,message);
//    }
//
//
//    public void send3(String key,String message){
//        rabbitTemplate.convertAndSend(RabbitConfig.S59_FANOUT_EXCHANGE,key,message);
//    }

    public void sendCreateOrderMessage(String key,Order order){
        rabbitTemplate.convertAndSend(RabbitConfig.S59_FANOUT_EXCHANGE,key,order);
    }
}
